/**
 @file csdn_algo.h
 @author  lyfan
 @date 2021-08-02
 @version v1.0
*/
#ifndef _WX_ALGO_H_
#define _WX_ALGO_H_
#include <asm/ioctl.h>


#define WXMODULE_NAME						"wxcoder"

// Truncates the full __FILE__ path, only displaying the basename
#define __FILENAME__ \
	(strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)

// Convenient macros for printing out messages to the kernel log buffer
#define wxdrv_err(fmt, ...) \
	printk(KERN_ERR WXMODULE_NAME "|%s|%s|%d|" fmt, __FILENAME__, __func__, \
		__LINE__, ## __VA_ARGS__)
#define wxdrv_info(fmt, ...) \
	printk(KERN_INFO WXMODULE_NAME "|%s|%s|%d|" fmt, __FILENAME__, __func__, \
		__LINE__, ## __VA_ARGS__)

#ifdef WX_DEBUG
#define debug(fmt, ...) \
	printk(KERN_ERR WXMODULE_NAME "|%s|%s|%d|" fmt, __FILENAME__, __func__, \
		__LINE__, ## __VA_ARGS__)
#else
#define debug(fmt, ...) do{}while(0)
#endif

struct wxcoder_device_t {
	struct page **pages;
	unsigned size;
	unsigned npages;
	char *vbase;
};

typedef struct _wx_algo_info{
	void *algo_start;
	uint32_t algo_len;
	uint32_t magic;
} wx_algo_info;

/*----------------------------------------------------------------------------
 * IOCTL Interface
 *----------------------------------------------------------------------------*/
// The magic number used to distinguish IOCTL's for our device
#define ALGO_IOCTL_MAGIC				'O'

// The number of IOCTL's implemented, used for verification
#define ALGO_NUM_IOCTLS				3
#define WX_TRACE_DECT				_IOR(ALGO_IOCTL_MAGIC, 0, int32_t)
#define WX_DYN_LOAD					_IO(ALGO_IOCTL_MAGIC, 1)
#define WX_ALGOMODULE_LOAD			_IOW(ALGO_IOCTL_MAGIC, 2, wx_algo_info)

#endif		// _WX_ALGO_H_

